import { Controller, Get, Post, Body, Patch, Param, Delete, Session } from '@nestjs/common';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/login.dto';

import { Public } from 'src/common/JWT/public.decorator';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
@ApiTags("用户相关")
@Controller('user')
export class UserController {
    constructor(private readonly userService: UserService) { }

    //登录
    @Public()
    @ApiOperation({ summary: '登陆' })
    @Post('login')
    login(@Body() loginData) {

        return this.userService.toLogin(loginData);
    }

    //注册
    @Public()
    @ApiOperation({ summary: '注册' })
    @Post('register')
    register(@Body() createUserDto: CreateUserDto) {
        return this.userService.register(createUserDto);
    }
}
